Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Creating and Configuring a Draw Context

You create a draw context object by calling a constructor function such as Q3MacDrawContext_New or Q3PixMapDrawContext_New . These functions take as a parameter a pointer to a data structure that contains information about the draw context you want to create. For example, you pass the Q3MacDrawContext_New function a pointer to a structure of type TQ3MacDrawContextData , defined as follows:

typedef struct TQ3MacDrawContextData {
    TQ3DrawContextData                              drawContextData;
    CWindowPtr                                      window;
    TQ3MacDrawContext2DLibrary                      library;
    gxViewPort                                      viewPort;
    CGrafPtr                                        grafPort;
} TQ3MacDrawContextData;

The first field is just a draw context data structure that contains basic information about the draw context (see "About Draw Context Objects" ). The remaining fields contain specific information about the Mac OS window and 2D graphics library associated with the draw context.

See Listing 7 for a sample routine that creates a Macintosh draw context.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |